import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../views/layout/Layout' // 主容器组件
const _import = require('./_import_' + process.env.NODE_ENV + '.js') // 加载路由方法（这样就不需要申明了）

Vue.use(Router)

export const constantRouterMap = [ // 公共路由
  { path: '', redirect: '/index' },
  { path: '',
    component: Layout,
    children: [{
      path: 'index',
      component: _import('index/index'),
      name: 'index',
      title: '首页'
    }]
  },
  { path: '',
    component: Layout,
    children: [{
      path: 'resource',
      component: _import('resource/index'),
      name: 'resource',
      meta: {name: 'personal', title: '流量资源'}
    }, {
      path: 'ssbanner',
      component: _import('resource/ssbanner'),
      name: 'ssbanner',
      meta: {name: 'personal', title: '搜索引擎'}
    }, {
      path: 'sjbanner',
      component: _import('resource/sjbanner'),
      name: 'sjbanner',
      meta: {name: 'sjbanner', title: '社交广告'}
    }, {
      path: 'spbanner',
      component: _import('resource/spbanner'),
      name: 'spbanner',
      meta: {name: 'sjbanner', title: '视频广告'}
    }, {
      path: 'yybanner',
      component: _import('resource/yybanner'),
      name: 'yybanner',
      meta: {name: 'sjbanner', title: '应用广告'}
    }, {
      path: 'hdbanner',
      component: _import('resource/hdbanner'),
      name: 'hdbanner',
      meta: {name: 'sjbanner', title: '互动广告'}
    }, {
      path: 'xxbanner',
      component: _import('resource/xxbanner'),
      name: 'xxbanner',
      meta: {name: 'sjbanner', title: '信息流广告'}
    }]
  },
  { path: '',
    component: Layout,
    children: [{
      path: 'customer',
      component: _import('customer/index'),
      name: 'customer',
      icon: 'dashboard',
      title: '客户案例'
    }]
  },
  { path: '',
    component: Layout,
    children: [{
      path: 'about',
      component: _import('about/index'),
      name: 'about',
      meta: {name: 'zizhi', title: '关于我们'}
    }, {
      path: 'zizhi',
      component: _import('about/zizhi'),
      name: 'zizhi',
      meta: {name: 'zizhi', title: '媒体资质'}
    }, {
      path: 'fengcai',
      component: _import('about/fengcai'),
      name: 'fengcai',
      meta: {name: 'fengcai', title: '亦盛风采'}
    }]
  },
  { path: '',
    component: Layout,
    children: [{
      path: 'join',
      component: _import('join/index'),
      name: 'join',
      icon: 'dashboard',
      title: '加入我们'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: 'weidai',
      component: _import('customer/weidai'),
      name: 'weidai'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: '360web',
      component: _import('customer/360web'),
      name: '360web'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: 'gzh',
      component: _import('customer/gzh'),
      name: 'gzh'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: 'pyq',
      component: _import('customer/pyq'),
      name: 'pyq'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: 'jiali',
      component: _import('customer/jiali'),
      name: 'jiali'
    }]
  },
  { path: '',
    component: Layout,
    hidden: true,
    children: [{
      path: '19lou',
      component: _import('customer/19lou'),
      name: '19lou'
    }]
  }
  // {
  //   path: '*',
  //   component: Layout,
  //   redirect: 'login'
  // }
]

let myRouter = new Router({
  mode: 'history',
  routes: constantRouterMap
})
// 判断是否登录

export default myRouter
